package com.learn.security.modules.security;

import com.learn.security.modules.vo.UserDto;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * @author lee
 */
public class LoginUser extends User {

    /**
     * 用户信息
     */
    private UserDto userDto;

    /**
     * 登录用户类型
     */
    private LoginUserType loginUserType;

    public LoginUser(
            UserDto user,
            LoginUserType loginUserType,
            String username,
            String password,
            boolean enabled,
            boolean accountNonExpired,
            boolean credentialsNonExpired,
            boolean accountNonLocked,
            Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
        this.userDto = user;
        this.loginUserType = loginUserType;
    }

    public UserDto getUserDto() {
        return userDto;
    }

    public void setUserDto(UserDto userDto) {
        this.userDto = userDto;
    }

    public LoginUserType getLoginUserType() {
        return loginUserType;
    }

    public void setLoginUserType(LoginUserType loginUserType) {
        this.loginUserType = loginUserType;
    }
}
